Skip to content

feat: pack oversized BigInt as MessagePack ext 0x42 - #25693

Merged
godsflaw merged 1 commit into
msgpack:masterfrom
enochgroot:feat/bigint-ext
Sep 19, 2026
Merged

godsflaw merged 1 commit into
msgpack:masterfrom
enochgroot:feat/bigint-ext

Conversation

@enochgroot

Copy link
Copy Markdown
Collaborator

Summary

Pack bigint values outside the int64/uint64 range as MessagePack ext type 0x42 (msgpackr useBigIntExtension two's-complement payload) and unpack that type back to bigint. Payload is capped at 256 bytes. Values that still fit 64-bit integer range keep using integer wire.

Test plan

  • node --test test/bigint.test.js (20 tests)
  • npm test (233 tests, 0 fail)
  • CI on this PR

Covers uint256, 64-bit boundaries (2^64, -2^63-1), nested arrays/maps/objects, 256-byte cap, empty/oversize/other-ext unpack, and in-range BigInt still on integer wire (0xcf / 0xd3).

Values outside int64/uint64 pack as msgpackr useBigIntExtension
(two's-complement, type 0x42) with a 256-byte payload cap. In-range
values still use integer wire. Unpack of ext 0x42 returns bigint.
@godsflaw
godsflaw merged commit c0f78a1 into msgpack:master Sep 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants